package cn.gok.dao;

import cn.gok.pojo.Product;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface ProductMapper {
    int deleteByPrimaryKey(Integer id);

    //增添商品
    int insert(Product record);

    int insertSelective(Product record);

    Product selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Product record);

    int updateByPrimaryKey(Product record);

    List<Product> queryAllProducts();

    List<Product> queryProductsByIdAndName(@Param("id") Integer id,@Param("name") String name);

    //商品详情
    Product queryProductById(Integer id);

    //商品上下架
    int updateProductStatus(Integer id,Integer status);


    //商品的模糊查询
    List<Product> selectByKeyWord(@Param("keyword") String keyword,
                                  @Param("categoryId") int categoryId,
                                  @Param("orderBy") String orderBy);



    int productCount();

    int updatPhotoById(@Param("id") int photoId,@Param("address") String url);
}